const white_list = [
    '/',
    '/singin',
    '/user/signin',
    '/registered',
    '/Details',
    '/announcement',
    '/MP_verify_422xUSYt1071UAUK.txt'
];

const defualt_url = '/';
module.exports =  async (ctx, next) => {
    if(ctx.method == 'POST'){
        await next();
    }
    else{
        if(white_list.includes(ctx.originalUrl) != -1){
            await next();
        }
        else{
            if(ctx.session == undefined || ctx.session.userId == undefined){
                ctx.redirect(defualt_url);
            }
            else{
                await next();
            }
        }
    }
}